using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ReportViewer.ParameterControls
{
    /// <summary>
    /// Parameter Control ComboBox
    /// </summary>
    public class Pulldown : UserControl
    {
        /// <summary>
        /// Load the object
        /// </summary>
        /// <param name="label">The Label to be displayed</param>
        /// <param name="name">Name of the Control</param>
        public Pulldown(string label, string name)
        {
            InitializeComponent();

            lblTitle.Text = label;
            ddlList.Name = name;
        }

        /// <summary>
        /// Bind the Control to a list
        /// </summary>
        /// <param name="list">The Key Value Pair to be bound</param>
        public void BindData(List<KeyValuePair<String, Int32?>> list)
        {
            ddlList.DataSource = list;
            ddlList.DisplayMember = "Key";
            ddlList.ValueMember = "Value";
        }

        /// <summary> 
        /// Required designer variable.
        /// </summary>
        private readonly System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lblTitle = new System.Windows.Forms.Label();
            this.ddlList = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            // 
            // lblTitle
            // 
            this.lblTitle.AutoSize = true;
            this.lblTitle.Location = new System.Drawing.Point(0, 10);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new System.Drawing.Size(77, 13);
            this.lblTitle.TabIndex = 2;
            this.lblTitle.Text = "Title goes here";
            // 
            // ddlList
            // 
            this.ddlList.FormattingEnabled = true;
            this.ddlList.Location = new System.Drawing.Point(0, 26);
            this.ddlList.Name = "ddlList";
            this.ddlList.Size = new System.Drawing.Size(187, 21);
            this.ddlList.TabIndex = 4;
            // 
            // Pulldown
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.ddlList);
            this.Controls.Add(this.lblTitle);
            this.Name = "Pulldown";
            this.Size = new System.Drawing.Size(222, 57);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private Label lblTitle;
        private ComboBox ddlList;
    }
}
